<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include.jsp" %>
<%
/* 	String name = ""; //用户名
	String passward = ""; //密码
	Cookie[] cookies=request.getCookies(); 
	if(cookies!=null){ 
 		for(int i=0;i<cookies.length;i++){
  			if(cookies[i].getName().equals("admin")){  
   				name=cookies[i].getValue().split("-")[0]; 
   				passward=cookies[i].getValue().split("-")[1]; 
   				request.setAttribute("admin",name);  //存用户名
   				request.setAttribute("admin",passward); //存密码
  			}
 		}
	}  */
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>登录 | 短信平台</title>
<jsp:include page="/WEB-INF/jsp/common/commonlist.jsp"></jsp:include>
<script type="text/javascript">
  	if (top.location != self.location) {top.location=self.location;};
  	function onloadFunc(){
  		document.getElementById('j_username').focus();
  	}
  	function wait(){
   	document.getElementById('errorMsg').innerHTML = "登录中……";
   	document.getElementById('errorMsg').style.display = 'block';
   	document.getElementById('loginbut').disabled = true;
   	document.getElementById('resetbut').disabled = true;
  		return true;
  	}
	function aa(){
		if(event.keyCode==13){
			document.getElementById('j_password').focus();
		}
	}
	function bb(){
		if(event.keyCode==13){
			SubmitForm();
		}
	}		
	function SubmitForm(){				
		document.getElementById("loginForm").submit();
		document.getElementById('j_username').focus();
	}		
</script>
</head>
<body id="login" onload="onloadFunc()">
<div id="login-wrapper" class="png_bg">
  <div id="login-top">
    <h1>手机短信平台</h1>
    <!-- Logo (221px width) -->
    <h2 style="color:white">&nbsp&nbsp&nbsp&nbsp&nbsp欢迎使用中讯通</h2> </div>
  <!-- End #logn-top -->
  <div id="login-content">
    <form id="loginForm" action="<c:url value='j_spring_security_check'/>" method="POST">
      <p> 
        <label>用户名</label>
        <input class="text-input" type="text" id='j_username' name='j_username' maxlength="56"  value='${name}' onkeyup="aa()" />
      </p>
      <div class="clear"></div>
      <p>
        <label>密 码</label>
        <input class="text-input" type="password" id='j_password' name='j_password' maxlength="16" value="${passward}" onkeyup="bb()" />
      </p>
      <div class="clear">
      	<c:choose>
		  <c:when test="${not empty SPRING_SECURITY_LAST_EXCEPTION}">
		  	<span id="errorMsg" style="display:block"><img src="images/icons/cross_circle.png" /><c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/></span>
		  </c:when>
		  <c:otherwise>
		    <span id="errorMsg" class="error" ></span>
		  </c:otherwise>
		</c:choose>
	  </div>
      <p id="remember-password">
      	<input type="checkbox" name="checked" id="checked"/> 保存信息</p>
      <div class="clear"></div>
	      <table style="width:100%;padding:0;margin-top:4px;">
	      	<tr>
	      		<td style="width:100px;"></td>
		      	<td>
		      		<input class="button" type="button" value="登 录" onclick="SubmitForm()" style="width:80px;"/>
		      	</td>       
		      	<td>
		      		<input type="reset" class="button" value="重 置"  style="width:80px;"/>
		      	</td>
	        </tr>
	      </table>
    </form>
  </div>
  <!-- End #login-content -->
</div>
<!-- End #login-wrapper -->
</body>
</html>
